<?php

namespace app\api\controller;

use app\admin\model\Ab as AbModel;
use app\admin\model\Order as OrderModel;
use app\common\controller\Api;

/**
 * 接口
 */
class Track extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function userload()
    {
        $recordId = $this->request->post('record_id');
        // OrderModel::where('id', $recordId)->setInc('display_num');
        $this->success('请求成功');
    }

    public function userclick()
    {
        $this->success('请求成功');
    }

    public function userurl()
    {
        $recordId = $this->request->get('recordId');
        $order = OrderModel::get($recordId);
        $order->save(['click_num' => $order['click_num'] + 1]);
        return redirect($order['whatsup_url'], [], 302);
    }
}
